<?php
/**
 * Created by PhpStorm.
 * User: yangfan
 * Date: 2019/12/13
 * Time: 2:35 PM
 */

namespace App\VO;

trait BaseSearchInfoTrait
{
    /**
     * 页数
     * @var int
     */
    public $page = 1;

    /**
     * @var int
     */
    public $pageSize = 10;

    /**
     * 排序 asc/desc
     * @var array
     */
    public $orderBy = [
        'id desc',
    ];

    /**
     * @return int
     */
    public function getPage(): int
    {
        return $this->page;
    }

    /**
     * @param int $page
     */
    public function setPage(int $page): void
    {
        $this->page = $page;
    }

    /**
     * @return int
     */
    public function getPageSize(): int
    {
        return $this->pageSize;
    }

    /**
     * @param int $pageSize
     */
    public function setPageSize(int $pageSize): void
    {
        $this->pageSize = $pageSize;
    }

    /**
     * @return array
     */
    public function getOrderBy(): array
    {
        return $this->orderBy;
    }

    /**
     * @param array $orderBy
     */
    public function setOrderBy(array $orderBy): void
    {
        $this->orderBy = $orderBy;
    }

    /**
     * @return string
     */
    public function getOrderByRaw(): string
    {
        return implode(',', $this->orderBy);
    }
}
